package io.webchat.wdzl.netty;

import io.netty.channel.Channel;
import io.webchat.WebChatApplication;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

/**
 * 用户id 和channel 的关联关系处理
 */
@Slf4j
public class UserChanelRel {




    private static HashMap<String, Channel> manage = new HashMap<>();

    public static  void put(String senderId,Channel channel){
        manage.put(senderId,channel);
    }

    public static Channel get(String senderId){
        return manage.get(senderId);
    }

    public static void output(){
        for (Map.Entry<String,Channel> entry  :manage.entrySet()) {
            log.info("UserId======>{},ChannelId======>{}",entry.getKey(),entry.getValue().id().asLongText());
        }
    }



}
